#include "tal_memory.h"

#include "app_common.h"
#include "app_key.h"
#include "app_mfg.h"
#include "app_rel.h"
#include "bsp.h"



VOID_T set_rel_status(UINT8_T channel)
{
  TUYA_GPIO_NUM_E rel_pins[CHANNEL_NUM] = {REL_PIN_1, REL_PIN_2, REL_PIN_3, REL_PIN_4};
  if (channel < CHANNEL_NUM)
  {
    TUYA_GPIO_NUM_E pin = rel_pins[channel];
    TAL_PR_TRACE("device_status.relStatus: %d & (1 << channel) : %d ", device_status.relStatus, device_status.relStatus & (1 << channel));
    if (device_status.relStatus & (1 << channel))
    {
      // tal_cpu_force_wakeup();
      tkl_gpio_write(pin, TUYA_GPIO_LEVEL_HIGH);
    }
    else
    {
      tkl_gpio_write(pin, TUYA_GPIO_LEVEL_LOW);
      // tal_cpu_allow_sleep();
    }
  }
}








